<?php

namespace support;

/**
 * Undocumented class
 *
 * @Description
 */
class ErrorCode
{
    const CODE_OK = 0;

    const TOO_MANY_REQUESTS = 429;
    const CODE_PARAMS_ERROR = 1000;
    const  TOKEN_VERIFY_ERROR = 1001;
    const  SIGN_VERIFY_ERROR = 1002;
    const  VERIFY_SIGN_TIME_ERROR = 1003;
    const  ERROR_NOTICE_1004 = 1004;
    const  ERROR_NOTICE_1005 = 1005;
    const  ERROR_NOTICE_1006 = 1006;
    const  ERROR_NOTICE_1007 = 1007;
    const  ERROR_NOTICE_1008 = 1008;
    const  ERROR_NOTICE_1009 = 1009;
    const  ERROR_NOTICE_1010 = 1010;
    const  ERROR_NOTICE_1011 = 1011;
    const  ERROR_NOTICE_1012 = 1012;
    const  ERROR_NOTICE_1013 = 1013;
    const  ERROR_NOTICE_1014 = 1014;
    const  ERROR_NOTICE_1015 = 1015;

    const  ERROR_COMMON_CODE = 9999;

    static function getErrorMessages($code = null)
    {
        $messages = [
            self::CODE_OK => 'ok',
            self::ERROR_COMMON_CODE => "通用错误码，自己设置msg",
            self::CODE_PARAMS_ERROR => '参数错误',
            self::TOKEN_VERIFY_ERROR => 'token登录失败',
            self::SIGN_VERIFY_ERROR => '签名错误',
            self::VERIFY_SIGN_TIME_ERROR => '时间戳格式不合法',
            self::TOO_MANY_REQUESTS => '请求过于频繁,请稍后再试!',
            self::ERROR_NOTICE_1004 => '您已经签过到啦!',
            self::ERROR_NOTICE_1005 => "签到任务不存在",
            self::ERROR_NOTICE_1006 => "配置错误",
            self::ERROR_NOTICE_1007 => "补签次数不足",
            self::ERROR_NOTICE_1008 => "评论不存在",
            self::ERROR_NOTICE_1009 => "你只能删除自己的评论",
            self::ERROR_NOTICE_1010 => "请先去创角再来发表评论！",
            self::ERROR_NOTICE_1011 => "已经领取过！",
            self::ERROR_NOTICE_1012 => "未知错误！",
            self::ERROR_NOTICE_1013 => "票数不足！",
            self::ERROR_NOTICE_1014 => "还未绑定支付宝！",
            self::ERROR_NOTICE_1015 => "还未绑定微信！",
        ];

        if (isset($code)) {
            return $messages[$code] ?? '';
        }

        return $messages;
    }
}
